};
static void gdk_wayland_device_pad_iface_init (GdkDevicePadInterface *iface);
+static void init_pointer_data (GdkWaylandPointerData *pointer_data,
+ GdkDisplay *display_wayland,
+ GdkDevice *master);
static void pointer_surface_update_scale (GdkDevice *device);
#define GDK_TYPE_WAYLAND_DEVICE_PAD (gdk_wayland_device_pad_get_type ())
NULL);
tablet->master = master;
+ init_pointer_data (&tablet->pointer_info, display, tablet->master);
+
tablet->stylus_device = stylus_device;
tablet->eraser_device = eraser_device;
struct zwp_tablet_v2 *wp_tablet)
{
GdkWaylandSeat *seat = data;
- GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
GdkWaylandTabletData *tablet;
tablet = g_new0 (GdkWaylandTabletData, 1);
tablet->seat = GDK_SEAT (seat);
- tablet->pointer_info.current_output_scale = 1;
- tablet->pointer_info.pointer_surface =
- wl_compositor_create_surface (display_wayland->compositor);
+
tablet->wp_tablet = wp_tablet;
seat->tablets = g_list_prepend (seat->tablets, tablet);
struct wl_output *output)
{
- GdkWaylandSeat *seat = data;
+ GdkDevice *device = data;
+ GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (device));
+ GdkWaylandTabletData *tablet;
GDK_DISPLAY_NOTE (seat->display, EVENTS,
g_message ("pointer surface of seat %p entered output %p",
seat, output));
- seat->pointer_info.pointer_surface_outputs =
- g_slist_append (seat->pointer_info.pointer_surface_outputs, output);
+ tablet = gdk_wayland_seat_find_tablet (seat, device);
- pointer_surface_update_scale (seat->master_pointer);
+ if (tablet)
+ {
+ tablet->pointer_info.pointer_surface_outputs =
+ g_slist_append (seat->pointer_info.pointer_surface_outputs, output);
+ }
+ else
+ {
+ seat->pointer_info.pointer_surface_outputs =
+ g_slist_append (seat->pointer_info.pointer_surface_outputs, output);
+ }
+
+ pointer_surface_update_scale (device);
}
static void
struct wl_surface *wl_surface,
struct wl_output *output)
{
- GdkWaylandSeat *seat = data;
+ GdkDevice *device = data;
+ GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (device));
+ GdkWaylandTabletData *tablet;
GDK_DISPLAY_NOTE (seat->display, EVENTS,
g_message ("pointer surface of seat %p left output %p",
seat, output));
- seat->pointer_info.pointer_surface_outputs =
- g_slist_remove (seat->pointer_info.pointer_surface_outputs, output);
+ tablet = gdk_wayland_seat_find_tablet (seat, device);
+
+ if (tablet)
+ {
+ tablet->pointer_info.pointer_surface_outputs =
+ g_slist_remove (seat->pointer_info.pointer_surface_outputs, output);
+ }
+ else
+ {
+ seat->pointer_info.pointer_surface_outputs =
+ g_slist_remove (seat->pointer_info.pointer_surface_outputs, output);
+ }
- pointer_surface_update_scale (seat->master_pointer);
+ pointer_surface_update_scale (device);
}
static const struct wl_surface_listener pointer_surface_listener = {
{
}
+static void
+init_pointer_data (GdkWaylandPointerData *pointer_data,
+ GdkDisplay *display,
+ GdkDevice *master)
+{
+ GdkWaylandDisplay *display_wayland;
+
+ display_wayland = GDK_WAYLAND_DISPLAY (display);
+
+ pointer_data->current_output_scale = 1;
+ pointer_data->pointer_surface =
+ wl_compositor_create_surface (display_wayland->compositor);
+ wl_surface_add_listener (pointer_data->pointer_surface,
+ &pointer_surface_listener,
+ master);
+}
+
void
_gdk_wayland_display_create_seat (GdkWaylandDisplay *display_wayland,
guint32 id,
wl_data_device_add_listener (seat->data_device,
&data_device_listener, seat);
- seat->pointer_info.current_output_scale = 1;
- seat->pointer_info.pointer_surface =
- wl_compositor_create_surface (display_wayland->compositor);
- wl_surface_add_listener (seat->pointer_info.pointer_surface,
- &pointer_surface_listener,
- seat);
-
init_devices (seat);
+ init_pointer_data (&seat->pointer_info, display, seat->master_pointer);
if (display_wayland->tablet_manager)
{